home *** CD-ROM | disk | FTP | other *** search
/ Skunkware 5 / Skunkware 5.iso / src / X11 / seyon / SeDecl.h < prev    next >
C/C++ Source or Header  |  1995-06-21  |  12KB  |  407 lines

  1. /*
  2.  * This file is part of the Seyon, Copyright (c) 1992-1993 by Muhammad M.
  3.  * Saggaf. All rights reserved.
  4.  *
  5.  * See the file COPYING (1-COPYING) or the manual page seyon(1) for a full
  6.  * statement of rights and permissions for this program.
  7.  */
  8.  
  9. #include <stdio.h>
  10. #include <X11/Intrinsic.h>
  11.  
  12. extern Boolean  do_script(),
  13.                 DoToggleCapture(),
  14.                 SeGetToggleState();
  15. extern char    *str_strip_lead_end_space(),
  16.                *str_strip_lead_space(),
  17.                *str_strip_end_space(),
  18.                *str_stripspc_copy(),
  19.                *StripSpace(),
  20.                *FmtString(),
  21.                *GetFirstWord(),
  22.                *GetNextWord(),
  23.                *expand_fname(),
  24.                 itoa(),
  25.                *mport(),
  26.                 MdmReadChar(),
  27.                 TermReadChar(),
  28.                 read_seyon_file();
  29. extern long     mbaud();
  30. extern int      open_modem(),
  31.                 trminp(),
  32.                 io_get_attr(),
  33.                 io_set_attr(),
  34.                 io_flush(),
  35.                 io_send_break(),
  36.                 lock_tty(),
  37.                 SeFork(),
  38.                 coninp(),
  39.                 read_mbyte(),
  40.                 dial_number(),
  41.                 redial(),
  42.                 readbyte(),
  43.  
  44.                 CloseModem(),
  45.                 OpenModem(),
  46.                 MdmSetGetBaud(),
  47.                 MdmSetGetCSize(),
  48.                 MdmSetGetParity(),
  49.                 MdmSetGetStopBits(),
  50.                 MdmSetGetIStrip(),
  51.                 MdmSaveRestoreAttr(),
  52.                 Online(),
  53.  
  54.                 SuspContTerminal(),
  55.                 get_modem_fio();
  56. extern FILE    *open_file(),
  57.                *open_file_va();
  58. extern void     send_break(),
  59.                 show(),
  60.                 showf(),
  61.                 SeyonMessage(),
  62.                 SeyonMessagef(),
  63.                 StartTerminal(),
  64.                 KillTerminal(),
  65.                 RestartTerminal(),
  66.                 getword(),
  67.  
  68.                 se_warning(),
  69.                 se_warningf(),
  70.                 SeError(),
  71.                 SeErrorF(),
  72.                 SePError(),
  73.                 SePErrorF(),
  74.                 SeNotice(),
  75.                 SeNoticeF(),
  76.                 ShowOpenModemErrMsg(),
  77.  
  78.                 setup_signal_handlers(),
  79.                 exec_close_script(),
  80.                 io_set_speed(),
  81.                 s_exit(),
  82.                 unlock_tty(),
  83.                 SeSetUnsetToggle(),
  84.                 ProcRequest(),
  85.                 write_child_info(),
  86.                 writef_child_info(),
  87.                 exec_cmd(),
  88.                 ShellCommand(),
  89.                 ExecShellCommand(),
  90.                 sendbyte(),
  91.                 send_tbyte(),
  92.                 send_slowly(),
  93.                 sendf_slowly(),
  94.                 cancel_dial(),
  95.                 SeBeep(),
  96.                 Beep(),
  97.                 SeSetViewportDimFromMultiList(),
  98.                 get_dial_info(),
  99.                 TopDial(),
  100.                 SeSetDialogValue(),
  101.                 xc_setflow(),
  102.                 set_rtscts(),
  103.                 RemoveCurrentItem(),
  104.                 DialCirculate(),
  105.                 DialerEnd(),
  106.                 read_file(),
  107.                 read_pipe_data(),
  108.                 write_pipe_data(),
  109.                 read_close_file(),
  110.                 dial(),
  111.                 sync_modem_attr(),
  112.                 PortToTty(),
  113.                 do_exit(),
  114.                 get_line(),
  115.                 getline(),
  116.                 lc_word(),
  117.                 toggle_flag(),
  118.                 cpmode(),
  119.                 set_onoff(),
  120.                 SetStatusMessage(),
  121.                 set_modem_fio(),
  122.                 set_modem_attr(),
  123.                 get_modem_attr(),
  124.                 mattach(),
  125.  
  126.                 MdmIFlush(),
  127.                 MdmPurge(),
  128.                 MdmHangup(),
  129.                 MdmPutString(),
  130.  
  131.                 DestroyShell(),
  132.                 DestroyShellCallBack(),
  133.                 EditFile(),
  134.                 ExecProcRequest(),
  135.                 ExecExit(),
  136.                 SePopupNoticeF(),
  137.                 SeSetViewportDimFromList(),
  138.                 SeSetViewportDimensions(),
  139.                 SetStatusMessagef(),
  140.                 SeSetWidgetWidth(),
  141.                 SeSetWidgetHeight(),
  142.                 SeSetValue(),
  143.                 SeSetLabel(),
  144.                 restore_orig_mode(),
  145.                 GetWord(),
  146.                 FunMessage(),
  147.                 IdleGuard(),
  148.                 mprintf(),
  149.                 PopupError(),
  150.  
  151.                 kill_w_child(),
  152.                 ChildKillInternal(),
  153.                 ChildKillExternal(),
  154.                 w_exit_up(),
  155.                 w_kill_up(),
  156.                 PreProcessPrep(),
  157.                 PostProcessPrep(),
  158.                 SetKillButtonSens(),
  159.  
  160.                 ReadCommentedFile(),
  161.                 FreeList(),
  162.                 UpdateStatusBox(),
  163.                 CenterShell(),
  164.                 CenterShellOnRoot(),
  165.                 PositionShell(),
  166.                 ResetFlag(),
  167.                 SetSensitiveOn(),
  168.                 set_tty_mode();
  169. extern Widget   GetShell(),
  170.                 SePopupDialogGetString(),
  171.                 SeAddButton(),
  172.                 AddButton(),
  173.                 SeAddButtonWithClientData(),
  174.                 SeAddButtonWCD(),
  175.                 SeAddLabel(),
  176.                 SeAddToggle(),
  177.                 SeAddToggleWCD(),
  178.                 SeCreatePopup(),
  179.                 SeCreateTopLevelPopup(),
  180.                 SeAddDialog(),
  181.                 AddBox(),
  182.                 SeAddBox(),
  183.                 SeAddForm(),
  184.                 SeAddPaned(),
  185.                 AddPaned(),
  186.                 SeAddPopupWG(),
  187.                 SeAddPopup(),
  188.                 AddSimplePopup(),
  189.                 SeAddPopupOffset(),
  190.                 SeAddPopupUL(),
  191.                 SePopupNotice(),
  192.                 SePopupRadio(),
  193.                 PopupDialogGetValue(),
  194.                 SePopupDialogGetString(),
  195.                 SePopupDialogGetStringE();
  196. extern Dimension SeWidgetWidth(),
  197.                 SeWidgetHeight();
  198.  
  199. /*
  200.  *   Apprarently these two are not ANSI?
  201.  */
  202. #if __STDC__ == 1 && defined(SVR4)
  203. extern int      kill(),
  204.                 fileno();
  205. #endif
  206.  
  207. #if HAVE_TERMIOS
  208. extern struct termios oldmode,
  209.                 newmode;
  210. #else
  211. #if HAVE_TERMIO
  212. extern struct termio oldmode,
  213.                 newmode;
  214. #else
  215. #if HAVE_SGTTYB
  216. extern struct sgttyb oldmode,
  217.                 newmode;
  218. #endif
  219. #endif
  220. #endif
  221.  
  222. /*
  223.  * defined constants
  224.  */
  225.  
  226. #define VERSION "2.1"
  227. #define REVISION "4b"
  228.  
  229. #define SUSPEND_TERM              18
  230. #define CONTINUE_TERM             19
  231. #define START_TERM                20
  232. #define START_AUTO_ZM             21
  233. #define SET_MESSAGE               22
  234. #define KILL_TERM                 23
  235. #define EXIT_PROGRAM              24
  236. #define EXEC_SCRIPT               25
  237. #define TOP_DIAL                  26
  238. #define POPUP_ERROR               27
  239. #define TOP_DIAL_START            28
  240. #define DISPATCH_ACTION           29
  241.  
  242. #define SHELLPOS_HWFH             1
  243.  
  244. #define TIN_BUF 20                /* number of chars in a tiny buffer */
  245. #define LIT_BUF 40                /* number of chars in a little buffer */
  246. #define SM_BUF  80                /* number of chars in a small buffer */
  247. #define REG_BUF 256                /* number of chars in a regular buffer */
  248. #define LRG_BUF 1024            /* number of chars in a large buffer */
  249.  
  250. #define MDELAY  50000            /* delay of output to modem in command mode */
  251.  
  252. #define ERR_MDM_NOMODEM             -1
  253. #define ERR_MDM_LOCKED              -2
  254. #define ERR_MDM_OPENFAILED          -3
  255. #define ERR_MDM_RESETFLAGSFAILED    -4
  256.  
  257. #define TERM_SUSPEND   0
  258. #define TERM_CONTINUE  1
  259.  
  260. #define ATTR_SAVE      0
  261. #define ATTR_RESTORE   1
  262.  
  263. #define ACTION_NEW_ACTION           1
  264. #define ACTION_NEW_ARG              2
  265. #define ACTION_ARGS_END             3
  266. #define ACTION_PARSE_ERROR          4
  267. #define ACTION_DISPATCH            10
  268.  
  269. /*
  270.  * Modem lines
  271.  */
  272.  
  273. #define NUM_MDM_STAT 8
  274.  
  275. #define MDM_LE    0x001
  276. #define MDM_DTR   0x002
  277. #define MDM_RTS   0x004
  278. #define MDM_ST    0x008
  279. #define MDM_SR    0x010
  280. #define MDM_CTS   0x020
  281. #define MDM_DCD   0x040
  282. #define MDM_RNG   0x080
  283. #define MDM_DSR   0x100
  284.  
  285. /*
  286.  * macros
  287.  */
  288.  
  289. #define SSpc(str) str_strip_lead_end_space(str)
  290.  
  291. #define min(a,b) ((a) < (b) ? (a) : (b))
  292. #define max(a,b) ((a) > (b) ? (a) : (b))
  293.  
  294. #define ret_if_up(w, up_fl) {if (up_fl) {SeBeep(w);    return;}}
  295. #define ReturnIfTrue(flag) {if (flag) {Beep();    return;}}
  296. #define ErrorIfBusy() {if(inhibit_child) {Beep(); \
  297.   SeyonMessage("Busy with Another Process"); return;}}
  298.  
  299. #define GET_ARG() {getword(); if (eof_flag) return;}
  300. #define GETTEST_ARG(cmd) {GET_ARG(); if (word[0] == '\0') { \
  301.   SeErrorF("Missing argument to the command `%s'", cmd, "", ""); \
  302.   eof_flag = 1; return;}}
  303.  
  304. #define PopupCentered(popup,parent) \
  305.   {CenterShell(popup,parent); XtPopupSpringLoaded(popup);}
  306. #define PopupCenteredOnRoot(popup) \
  307.   {CenterShellOnRoot(popup);  XtPopupSpringLoaded(popup);}
  308. #define SimpleError(message) {Beep(); SeyonMessage(message); return;}
  309. #define SimpleErrorF(fmt,a,b,c) {Beep(); SeyonMessagef(fmt,a,b,c); return;}
  310.  
  311. #define FmtString0(fmt) FmtString(fmt,"","","")
  312. #define FmtString1(fmt,a) FmtString(fmt,a,"","")
  313. #define FmtString2(fmt,a,b) FmtString(fmt,a,b,"")
  314. #define FmtString3(fmt,a,b,c) FmtString(fmt,a,b,c)
  315.  
  316. /*
  317.  * Resource structures
  318.  */
  319.  
  320. struct _quickKeyRes {
  321.   Boolean     visible;
  322.   String      action;
  323. };
  324.  
  325. struct QueryResources {
  326.   String          modems;
  327.   String          script;
  328.  
  329.   String          defaultBPS;
  330.   int             defaultBits;
  331.   int             defaultParity;
  332.   int             defaultStopBits;
  333.   Boolean         stripHighBit;
  334.   Boolean         backspaceTranslation;
  335.   Boolean         metaKeyTranslation;
  336.   Boolean         xonxoffFlowControl;
  337.   Boolean         rtsctsFlowControl;
  338.   String          newlineTranslation;
  339.  
  340.   String          dialPrefix;
  341.   String          dialSuffix;
  342.   String          dialCancelString;
  343.  
  344.   int             dialTimeOut;
  345.   int             dialDelay;
  346.   int             dialRepeat;
  347.  
  348.   String          connectString;
  349.   String          noConnectString[4];
  350.  
  351.   Boolean         hangupBeforeDial;
  352.   Boolean         dialAutoStart;
  353.   String          dialDirFormat;
  354.   String          defaultPhoneEntries;
  355.  
  356.   String          startupAction;
  357.   String          postConnectAction;
  358.   Boolean         autoZmodem;
  359.   String          autoZmodemAction;
  360.  
  361.   int             modemVMin;
  362.   Boolean         ignoreModemDCD;
  363.   Boolean         hangupViaDTR;
  364.   String          modemAttentionString;
  365.   String          modemHangupString;
  366.   Boolean         hangupConfirm;
  367.   Boolean         exitConfirm;
  368.  
  369.   String          defaultDirectory;
  370.   String          scriptDirectory;
  371.   String          startupFile;
  372.   String          phoneFile;
  373.   String          protocolsFile;
  374.   String          captureFile;
  375.   String          helpFile;
  376.  
  377.   int             modemStatusInterval;
  378.   Boolean         idleGuard;
  379.   int             idleGuardInterval;
  380.   String          idleGuardString;
  381.   Boolean         showFunMessages;
  382.   int             funMessagesInterval;
  383.   String         *funMessages;
  384. };
  385.  
  386. extern XtAppContext app_con;
  387. extern struct   QueryResources qres;
  388. extern Widget   topLevel,
  389.                 genericWidget;
  390. extern Widget   dialWidget;
  391.  
  392. extern Boolean  inhibit_child;
  393. extern char     captureFile[REG_BUF],
  394.                 modem_port[REG_BUF],
  395.                *lptr;
  396. extern int      newlineTrMode;
  397. extern int      child_pipe[2];
  398. extern pid_t    w_child_pid;
  399. extern pid_t    childProcPid;
  400.  
  401. extern int      quote_flag;
  402. extern int      linkflag,
  403.                 eof_flag;
  404. extern char     word[],
  405.                *wptr,
  406.                 line[];
  407.